package com.water.web;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

/**
 * HTML协议
 * 
 * @author Administrator
 * 
 */
public class HtmlTool {

	public static String aaa(String ip) {
		String strMessage = "";
		try {
			BufferedReader reader = null;

			StringBuffer buffer = new StringBuffer();
			URL uploadServlet = new URL("http://www.ip138.com/ips1388.asp?action=2&ip="+ip);
			HttpURLConnection servletConnection = (HttpURLConnection) uploadServlet
					.openConnection();
			servletConnection.setRequestMethod("POST");
			servletConnection.setDoOutput(true);
			servletConnection.setDoInput(true);
			servletConnection.setAllowUserInteraction(true);
			InputStream inputStream = servletConnection.getInputStream();
			reader = new BufferedReader(new InputStreamReader(inputStream));
			while ((strMessage = reader.readLine()) != null) {
				buffer.append(strMessage);
			}

			System.out.println(strMessage);
			return strMessage;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return strMessage;
	}
	
	
}
